home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / patches / pgs3g1.lha / 3.0gUpdate / Macros.LHA / SendtoBME.rexx < prev    next >
OS/2 REXX Batch file  |  1995-03-24  |  4KB  |  126 lines

  1. /* $VER: SendtoBME.rexx 1.2 (22.03.95)
  2.    Copyright 1995 Soft-Logik Publishing Corporation
  3.    May not be distributed without Soft-Logik Publishing Corporation's express written permission */
  4.  
  5. OPTIONS RESULTS
  6. TRACE OFF
  7.  
  8. /* Make sure rexx support is opened */
  9. IF ~SHOW('L','rexxsupport.library') THEN
  10.    CALL ADDLIB('rexxsupport.library',0,-30)
  11.  
  12. ADDRESS 'PAGESTREAM'
  13.  
  14. /* Check and see if one picture is selected */
  15. getobject type objtype
  16. if objtype~=12 then do
  17.     ADDRESS 'PAGESTREAM'
  18.     allocarexxrequester '"Send to Editor Error!"' 368 59
  19.     reqhandle=result
  20.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  21.         Exithandle=result
  22.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'One picture must be selected to edit in BME.'"
  23.     addarexxgadget reqhandle TEXT 8 20 352 border none string "'Select only one picture and try again.'"
  24.     doarexxrequester reqhandle
  25.     freearexxrequester reqhandle
  26.     EXIT
  27. end
  28.  
  29. /* Export the picture to a temp file */
  30. 'lockinterface true'
  31. 'exportgraphic file t:HotLinkedPicture filter iffilbm status force'
  32. /* Eventually will just make picture external, but not this version */
  33. /* 'editpicture external file t:HotLinkedPicture' */
  34. 'refresh wait'
  35.  
  36. /* set the default BME path */
  37. bmepath='PageStream3:BME'
  38. preffile='PageStream3:SendtoBME.prefs'
  39.  
  40. /* If BME doesn't exist in the default path, check SendtoBME.prefs */
  41. if ~exists(bmepath) then do
  42.     if open(.ifile, preffile, 'R') then do
  43.         bmepath=readln(.ifile)
  44.         call close(.ifile)
  45.         askuser='no'
  46.         end
  47.     else do
  48.         askuser='yes'
  49.     end
  50.     /* If BME doesn't exist in the set pref path, ask the user where it is */
  51.     if ~exists(bmepath) | askuser='yes' then do
  52.         getfile TITLE "'Please locate BME'" load path "'PageStream3:'" file BME posbutton 'Ok' negbutton 'Cancel'
  53.         if RC=10 then signal cancel
  54.         bmepath=result
  55.         if open(.ifile, preffile, 'W') then do
  56.             call writeln(.ifile, bmepath)
  57.             call close(.ifile)
  58.         end
  59.     end
  60. end
  61.  
  62.  
  63. /* Run BME */
  64. ADDRESS COMMAND
  65. 'run >nil:' bmepath
  66.  
  67. /* Wait until the ARexx port shows up */
  68. do 20
  69.     if ~show(P, 'BME') then call delay(50)
  70. end
  71.  
  72. /* If the ARexx port didn't show up, alert the user and exit */
  73. if ~show(P, 'BME') then do
  74.     ADDRESS 'PAGESTREAM'
  75.     allocarexxrequester '"Send to Editor Error!"' 368 59
  76.     reqhandle=result
  77.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  78.         Exithandle=result
  79.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'BME could not be started.'"
  80.     doarexxrequester reqhandle
  81.     freearexxrequester reqhandle
  82.     'refresh continue'
  83.     'lockinterface false'
  84.     EXIT
  85. end
  86.  
  87. ADDRESS 'BME'
  88. 'screentofront'
  89. 'open t:HotLinkedPicture'
  90.  
  91. /* While the user is in BME, let's get some info about the pic from PageStream */
  92. ADDRESS 'PAGESTREAM'
  93. getpicture position pstem frame fflag contentoffset cstem contentscale cstem rotation rstem about rstem constrain cflag print pflag
  94. gettextwrap region wmode wrap wtype standoff wstem
  95.  
  96. /* Wait for the user to finish in BME */
  97. ADDRESS 'BME'
  98. do forever
  99.     'getpicture "t:hotlinkedpicture"'
  100.     if rc=0 then call delay(50)
  101.     else signal update
  102. end
  103.  
  104. /* update pgs and exit */
  105. UPDATE:
  106. ADDRESS 'PAGESTREAM'
  107. 'screentofront'
  108. /* Eventually will just make picture external, but not this version */
  109. /* 'editpicture path t:HotLinkedPicture' */
  110. /* 'editpicture internal' */
  111.  
  112. 'deleteobject'
  113. 'placegraphic file t:HotLinkedPicture filter iffilbm'
  114. editpicture position pstem.left pstem.top pstem.right pstem.bottom skew rstem.slant rstem.twist
  115. if fflag=ON then editpicture framed contentoffset cstem.x cstem.y contentscale cstem.h cstem.v
  116. settextwrap wmode standoff wstem.x wstem.y wtype
  117. signal cancel
  118.  
  119. CANCEL:
  120. ADDRESS 'PAGESTREAM'
  121. 'refresh continue'
  122. 'lockinterface false'
  123. ADDRESS COMMAND
  124. 'delete t:HotLinkedPicture'
  125. EXIT
  126.